package com.zcp.pcsuitall.business;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;



public class SDCardManager {

    public static final String SDCARD = "/sdcard";
    
    public static String[] getFileList(String floder)
    {
        File file=new File(SDCARD+"/"+floder);
        return file.list();
    }
    
    /**
     * 读取文件中数据到缓存中。
     * @param filePath
     */
    private static void readDataFromFile(String filePath) {
        try {
            ByteBuffer w_buff = ByteBuffer.allocate(1024);
            FileInputStream fileInputStream = new FileInputStream(filePath);
            FileChannel inChannel = fileInputStream.getChannel();
            w_buff.clear();
            while (true) {
                int eof = inChannel.read(w_buff);
                if (eof == -1)
                    break;
                w_buff.flip();
                //读取缓存中内容。
                w_buff.clear();
            }

            inChannel.close();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }  
    
}
